package groep3.ssc.skaterViews;

import groep3.ssc.main.R;
import groep3.ssc.model.Race;
import android.content.Context;
import android.content.res.Resources;
import android.widget.TextView;

public class TotalDistanceView extends SkaterViewTemplate
{
    public TextView totalDistance;

    public TotalDistanceView(Context context)
    {
        super(context);
        totalDistance = new SkaterTextView(context);
        addView(totalDistance);
        subscribeToController();
    }

    @Override
    public void update(Race model)
    {
        Resources res = getResources();
        String meterAbbreviationString = res.getString(R.string.txtMeterAbbreviationString);
        this.totalDistance.setText("" + model.getSkater(model.getOurSkater()).getTotalDistance() + meterAbbreviationString);
    }

    @Override
    public String toString()
    {
        Resources res = getResources();
        String totalDistanceSkatedString = res.getString(R.string.txtTotalDistanceSkatedString);
        return totalDistanceSkatedString;
    }
}
